import math
from scipy.stats import norm
class pricer(object):
    @staticmethod
    def dOne(S,K,T,r,sigma,q):
        return (math.log(S/K)+(r-q+0.5*sigma**2)*T)/(sigma*math.sqrt(T))
    @staticmethod
    def callOption(S,K,sigma,T,r,q):
        if T==0:
            return max(S-K,0)
        else:
            d1=pricer.dOne(S,K,T,r,sigma,q)
            return math.exp(-q*T)*S*norm.cdf(d1)-K*math.exp(-r*T)*norm.cdf(d1-sigma*math.sqrt(T))
    @staticmethod
    def callDelta(S,K,sigma,T,r,q):
        d1=pricer.dOne(S,K,T,r,sigma,q)
        return math.exp(-q*T)*norm.cdf(d1)

if __name__=="__main__":
    pass